<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<body>
<style type="text/css">
	#coursewarev{
		padding: 15px;
		background: #fff;
		border-radius: 10px;
	}
	.layui-inline{
		width:50%;
		margin-left: 20%;
	}
	.layui-input-block{
		margin-left: 135px;
	}
	.layui-form-label{
		width: 100px;
	}
</style>
<div id="coursewarev">
	<fieldset class="layui-elem-field layui-field-title site-title">
		<legend><a name="fixbar">课件资源添加</a></legend>
	</fieldset>
	<form id="tbClassStateForm" method="post" class="layui-form white-bg radius">
		<input type = "hidden" name = "limit" value="${param.limit}">
		<input type = "hidden" name = "page" value="${param.page}">
		<input type="hidden" name="id" value="${model.id}">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">课程</label>
				<div class="layui-input-block">
					<select id="tbCurriculumid" name="tbCurriculumid" lay-verify="required"
							lay-search>
						<c:forEach var="d" items="${data}">
							<option value="${d.id }">${d.courseName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">资源简介</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" name="resourceprofile">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">
					<button type="button" class="layui-btn layui-btn-normal" id="test" lay-data="{accept: 'file'}">选择文件</button>				
				</label>
				<div class="layui-input-block">
					<input type="text" hidden="true" id = "uuid" name="uuid">
					<span id="filename" style="height: 50px; line-height: 50px; color: red;"></span>
				</div>
			</div>
		</div>
	</form>
	<script type="text/javascript">
		layui.use('form', function(){
		  	var form = layui.form;
		  	form.render('select');
		});
		layui.use('upload', function(){
			  var $ = layui.jquery, upload = layui.upload;
			  upload.render({
				elem: '#test',
				url: 'coursewarev/upload',
				auto: true,
				done: function(res){
					var str = res.msg.split(",");
					$("#uuid").val(str[1]);
					$("#filename").text(str[0]);
				}
			});
		});
	</script>
</div>
</body>
